<script setup>

</script>

<template>
<div>
  <el-form ref="form" :model="form" label-width="80px">
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="用户名">
        <el-input v-model="form.username" placeholder="手机号"></el-input>
      </el-form-item>
      <el-form-item label="密码">
        <el-input v-model="form.password" placeholder="验证码"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit()">登录</el-button>
        <el-button @click="onCancel()">取消</el-button>
      </el-form-item>
    </el-form>
  </el-form>
</div>
</template>
<style scoped>
</style>
<script>
import router from "@/router";

export default {
  data(){
    return {
      form:{
        username:"",
        password:""
      },
    }
  },
  watch:{},
  methods:{
    onSubmit(){
      this.axios.post(`http://localhost:8681/user/login`,this.form).then(res=>{
        var r = res.data;
        if (r.code == 200){
          this.$message.success("登录成功");
          router.push('/basic_info');
        }else {
          this.$message.error(r.msg);
        }
      })
    },
    onCancel(){
      this.form={
        username:"",
        password:""
      }
    }
  },
  created(){
  }
}
</script>